home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8505.arc / VOLT.BAS < prev   
BASIC Source File  |  1986-09-14  |  1KB  |  37 lines

  1. 10 ' PC VOLTMETER -- Copyright 1984 Michael A. Covington
  2. 20 ' Uses the PC Game Control Adapter to measure voltage.
  3. 30 ' Can be used with any of the voltmeter circuits in
  4. 40 ' the accompanying article provided the calibration
  5. 50 ' voltages used are within the range of the circuit.
  6. 70 CLS : KEY OFF
  7. 80 PRINT "PC VOLTMETER"
  8. 90 PRINT
  9. 100 PRINT "Connect first calibration voltage, ";
  10. 105 PRINT "then press any key."
  11. 110 IF INKEY$="" THEN 110
  12. 120 READING1 = 1/STICK(0)
  13. 140 PRINT "Reading taken."
  14. 141 PRINT
  15. 142 INPUT "Value of that voltage (in volts)";VOLTAGE1
  16. 150 PRINT
  17. 160 PRINT "Connect second calibration voltage, ";
  18. 165 PRINT "then press any key."
  19. 170 IF INKEY$="" THEN 170
  20. 180 READING2 = 1/STICK(0)
  21. 185 PRINT "Reading taken."
  22. 186 PRINT
  23. 190 INPUT "Value of that voltage (in volts)";VOLTAGE2
  24. 200 FACTOR = (READING2-READING1)/(VOLTAGE2-VOLTAGE1)
  25. 210 OFFSET = READING2 - (VOLTAGE2*FACTOR)
  26. 260 PRINT:PRINT "Calibrated"
  27. 280 PRINT
  28. 290 PRINT "PC VOLTMETER at your service..."
  29. 300 PRINT:PRINT "Press any key to take a reading"
  30. 320 IF INKEY$="" THEN 320
  31. 330 READING = 1/STICK(0)
  32. 340 VOLTAGE = (READING-OFFSET)/FACTOR
  33. 350 COLOR 15,0
  34. 360 PRINT USING "##.### volts";VOLTAGE
  35. 370 COLOR 7,0
  36. 380 GOTO 280
  37.